﻿using System.Drawing;
using GIMS.Def.Arguments;
using GIMS.Def.Operators;
using GIMS.Def.Settings;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;

namespace GIMS.Def.Test
{
    /// <summary>
    ///This is a test class for CanvasOperatorTest and is intended
    ///to contain all CanvasOperatorTest Unit Tests
    ///</summary>
    [TestClass()]
    public class CanvasOperatorTest
    {
        /// <summary>
        /// Reset GlobalSettings
        /// </summary>
        [TestInitialize()]
        public void MyTestInitialize()
        {
            GlobalSettings_Accessor.instance = null;
        }

        /// <summary>
        ///A test for CreateScriptPart
        ///</summary>
        [TestMethod()]
        public void createScriptPartTest()
        {
            CanvasOperator target = new CanvasOperator();
            ColorArgument arg = (ColorArgument) target.Argument;
            arg.Color = Color.Red;
            target.Settings[0].Active = true;
            GeometryArgument arg2 = (GeometryArgument) target.Settings[0].Argument;
            arg2.Width = 100;
            arg2.Height = 200;
            GlobalSettings.Instance.Settings.First(x => x.Name.Equals("Size")).Active = true;

            Assert.AreEqual("-size 100x200 canvas:rgba(255,0,0,1) -size 0x0", target.CreateScriptPart());
        }
    }
}
